data{
    int<lower=1> N;
    int B[N];
    int VB[N];
    int VT[N];
    int VC[N];
    int AVB[N];
}
parameters{
    real a;
    real bVC;
    real bVB;
    real bVT;
    real bAVB;
}
model{
    vector[N] lp;
    bAVB ~ normal( 0 , 10 );
    bVT ~ normal( 0 , 10 );
    bVB ~ normal( 0 , 10 );
    bVC ~ normal( 0 , 10 );
    a ~ normal( 0 , 10 );
    for ( i in 1:N ) {
        lp[i] = a + (bVB + bVC * VC[i] + bVT * VT[i]) * VB[i] + bAVB * AVB[i];
    }
    B ~ binomial_logit( 1 , lp );
}
generated quantities{
    vector[N] lp;
    real dev;
    dev = 0;
    for ( i in 1:N ) {
        lp[i] = a + (bVB + bVC * VC[i] + bVT * VT[i]) * VB[i] + bAVB * AVB[i];
    }
    dev = dev + (-2)*binomial_logit_lpmf( B | 1 , lp );
}
